src_sv=tcp_server.cpp
bin_sv=tcp_server.out
# src_ct=tcp_client.cpp
# bin_ct=tcp_client.out

# .PHONY:all
# all:$(bin_ct) $(bin_sv)

$(bin_sv):$(src_sv)
	g++ $^ -o $@ -std=c++11 -g -pthread -fno-inline
# $(bin_ct):$(src_ct)
# 	g++ $^ -o $@ -std=c++11 -g -pthread -fno-inline

.PHONY:clean memcheck_sv memcheck_ct
clean:
	@rm -f $(bin_ct) $(bin_sv)
memcheck_sv:
	# leak-check=full 指的是完全检查内存泄漏，
	# show-reachable=yes是显示内存泄漏的地点，
	# trace-children=yes是跟入子进程
	valgrind --tool=memcheck --leak-check=full --show-reachable=yes --trace-children=yes ./$(bin_sv) 8085
# memcheck_ct:
# 	valgrind --tool=memcheck --leak-check=full --show-reachable=yes --trace-children=yes ./$(bin_ct) 127.0.0.1 8085
